package homework;

import java.io.*;

public class Test2 {
    public static void main(String[] args) {
    /*Person person = new Person();
        person.setName("米娟");
        person.setAge(18);
        person.setGender("女");
        person.setMotivation(new String[]{"可爱", "喜欢"});
        try (FileOutputStream fos = new FileOutputStream("person.txt");
             ObjectOutputStream oos = new ObjectOutputStream(fos)){
            oos.writeObject(person);
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }*/
/*        try (FileInputStream fis = new FileInputStream("person.txt");
             ObjectInputStream oos = new ObjectInputStream(fis))
        {
            Person person = (Person) oos.readObject();
            System.out.println(person);
        } catch (IOException |ClassNotFoundException e) {
            System.out.println(e.getMessage());
        }*/
        File file = new File("person.txt");
        if (file.exists()){
            file.delete();
            System.out.println("删除成功");
        }
    }
}
